use std::{sync::{Mutex}, time::Duration, rc::{Rc, Weak}};

use tokio::{time, sync::mpsc::{Sender, Receiver, channel, error::TryRecvError}};

use crate::legan_piping::{storage::StorageSystem, message::Message};

/**
 * @author Almas software technologies muhtarjaan mahmood (مۇختەرجان مەخمۇت)
 * @email ug-project@outlook.com
 * @create date 2022-07-05 19:41:53
 * @modify date 2022-07-05 19:41:53
 * @desc [description]
*/


pub struct SingleFileStorageSystem {
    pub file_name: String,
    pub write_file_period_seconds: u8,
}

impl SingleFileStorageSystem {
    pub fn new_with_file_name(file_name: String, write_data_period: u8) -> SingleFileStorageSystem {
        let storage = SingleFileStorageSystem {
            file_name,
            write_file_period_seconds: write_data_period
        };
        storage
    }
    fn run_file_loop(&self) {

    }
}

#[async_trait::async_trait]
impl StorageSystem for SingleFileStorageSystem {
    async fn store_immediately(&self, message: &crate::legan_piping::message::Message) {
        
    }

    async fn store_with_schedule(&self, message: &crate::legan_piping::message::Message) {
        
    }

    async fn read_messages_at(&self, offset: u64, count: u16) -> Vec<Message> {
        vec![]
    }
}
